﻿using Little.Soldier;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;

namespace Little.Soldier.SWIFT
{
  [TypeConverter(typeof(IUnparsedTextList))]
  [DesignTimeVisible(false)]
  [ToolboxItem(false)]
  [Serializable]
  internal class UnparsedTextList
  {
    private List<string> _Texts = new List<string>();
    private const long _SerialVersionUID = 1L;
    private long _Id;

    internal virtual List<string> Texts
    {
      get
      {
        return this._Texts;
      }
    }

    internal virtual long Id
    {
      get
      {
        return this._Id;
      }
      set
      {
        this._Id = value;
      }
    }

    internal virtual int Size
    {
      get
      {
        return this.Texts.Count;
      }
    }

    internal UnparsedTextList()
    {
    }

    internal UnparsedTextList(string[] texts)
    {
      foreach (string str in texts)
        this.Texts.Add(str);
    }

    internal virtual void AddTex(SwiftMessage message)
    {
      this.AddTex(new U0007().U0004U0003(message));
    }

    internal virtual void AddTex(string text)
    {
      this.Texts.Add(text);
    }

    public override bool Equals(object obj)
    {
      if (this != obj)
        goto label_8;
label_7:
      return true;
label_8:
      if (obj == null || this.GetType() != obj.GetType())
        return false;
      UnparsedTextList unparsedTextList = (UnparsedTextList) obj;
      if (this.Texts == null)
      {
        if (unparsedTextList.Texts != null)
          return false;
        else
          goto label_7;
      }
      else if (!this.Texts.Equals((object) unparsedTextList.Texts))
        return false;
      else
        goto label_7;
    }

    internal virtual string U0081U0003()
    {
      if (this.Texts.Count == 0)
        return string.Empty;
      StringBuilder stringBuilder = new StringBuilder();
      foreach (string str in this.Texts)
        stringBuilder.Append(str);
      return ((object) stringBuilder).ToString();
    }

    public override int GetHashCode()
    {
      return 31 * 1 + (this.Texts != null ? this.Texts.GetHashCode() : 0);
    }

    internal virtual string U0082U0003(int index)
    {
      return this.Texts[index];
    }

        internal virtual SwiftMessage U0083U0003(int index)
        {
            return new U0007().U0005U0003(this.Texts[index]);
        }

    internal virtual bool U0084U0003(int index)
    {
      return UnparsedTextList.U0084U0003(this.U0082U0003(index));
    }

    internal static bool U0084U0003(string text)
    {
      switch (text)
      {
        case null:
          return false;
        default:
          if (text.IndexOf("{1:") >= 0)
            return true;
          else
            goto case null;
      }
    }

    internal virtual void U0086U0003(int index)
    {
      this.Texts.RemoveAt(index);
    }

    internal virtual void U0086U0003(string text)
    {
      this.Texts.Remove(text);
    }

    internal virtual void U0087U0003(string[] texts)
    {
      foreach (string str in texts)
        this.Texts.Add(str);
    }
  }
}
